@echo off

REM CAUTION! THIS FILE CANNOT SUPPORT UNICODE CHARACTERS!
REM DO NOT USE UNICODE CHARACTERS IN PATH, VARIABLE, AND COMMENT, ETC.
REM
REM # Build Script for Python Wheels on Windows Platform
REM
REM Module: MIAHX(C) / FFST / IFIRM
REM
REM Version: 0.4.10,
REM Last updated: October 2, 2024
REM
REM Combining all user-defined message structs into src/MiahxProto.idl,
REM and generating C++ and Python sources that FastDDS requires
REM
REM ## Contributor(s)
REM * YAO Naiming <[naiming@iscas.ac.cn](mailto:naiming@iscas.ac.cn)>
REM
REM Copyright (C) 2024-2025 MIAHX Contributors, ISCAS, and ASIC. All Rights Reserved.
REM Licensed under Apache-2.0.


set LIB_VERS=0.4.10
set PLAT_NAME=win_amd64

set LIB_MIAHX_FASTDDS=miahx_fastdds
set LIB_MIAHX_FASTDDS_API=miahx_fastdds_api
set LIB_MIAHX_SUPPORT=miahx_support

REM Build Python wheel package and install
echo -- Building Python wheels

mkdir dist

cd src
python setup_%LIB_MIAHX_FASTDDS%.py bdist_wheel --plat-name %PLAT_NAME%
python setup_%LIB_MIAHX_FASTDDS_API%.py bdist_wheel --plat-name %PLAT_NAME%
python setup_%LIB_MIAHX_SUPPORT%.py bdist_wheel --plat-name %PLAT_NAME%

cd %~dp0
pip install --force-reinstall ^
wheels\%LIB_MIAHX_FASTDDS%-%LIB_VERS%-py3-none-%PLAT_NAME%.whl ^
wheels\%LIB_MIAHX_FASTDDS_API%-%LIB_VERS%-py3-none-%PLAT_NAME%.whl ^
wheels\%LIB_MIAHX_SUPPORT%-%LIB_VERS%-py3-none-%PLAT_NAME%.whl

echo -- Creating and installing the wheel package - done

REM Clean intermediate files
rd /s /q "dist"

echo -- Cleaning intermediate files - done